﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Drawing;
using System.Globalization;
using System.Web.Mvc;

namespace StartMVC.Models
{
    [DisplayName("用户信息")]
    [DisplayColumn("Name")]
    public class Member
    {
        [Key]
        public int Id { get; set; }

        [DisplayName("会员帐号")]
        [Required(ErrorMessage = "请输入Email帐号")]
        [Description("我们直接以Email帐号作为会员登录帐号")]
        [MaxLength(250, ErrorMessage = "Email地址长度不能超过250个字符")]
        [Remote("CheckDup","Member",HttpMethod="POST",ErrorMessage="您输入的Email账号已经被注册了")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }
        [DisplayName("会员密码")]
        [Required(ErrorMessage = "请输入密码")]
        [Description("密码将会以SHA1进行哈希运算,通过SHA1哈希运算后的结果转为HEX表示法的字符串长度皆为40个字符")]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [DisplayName("中文姓名")]
        [Required(ErrorMessage = "请输入中文姓名")]
        [Description("暂时不考虑外国人英文姓名注册")]
        public string Name { get; set; }

        [DisplayName("网络昵称")]
        [Required(ErrorMessage = "请输入网络昵称")]
        [MaxLength(10, ErrorMessage = "网络昵称请勿超过10个字")]
        public string Nickname { get; set; }
        [DisplayName("会员注册时间")]
        public DateTime RegisterOn { get; set; }

        [DisplayName("会员启用认证码")]
        [MaxLength(36)]
        [Description("当AuthCode等于null时代表该会员已经通过了Email有效性验证")]
        public string Authcode { get; set; }


        public virtual ICollection<OrderHeader> Orders { get; set; }
    }
}